{
    _CP_.OPTIONS_HANDLER.set('name', {
        [Etype.string]: U.F.fn.obj,
    });
}

type Toptions_NAME = {
    /** 表单名称 */
    name?: string;
};

/**
 * 表单名控件注解
 * @param target 目标类型
 */
function ACname(target: any) {
    if (!U.isSubClass(_CP_, target)) { return; }

    // 处理器
    const original_options_handlers = target.prototype.options_handlers;
    target.prototype.options_handlers = function (this: _CP_<any>) {
        const options_handlers = original_options_handlers.call(this);

        U.O.setDefaultValue(options_handlers, 'name', _CP_.OPTIONS_HANDLER.get('name'));

        return options_handlers;
    };

    // 初始化
    const original_initializer = target.prototype.initializer;
    target.prototype.initializer = function (this: _CP_<any>) {
        original_initializer.call(this);

        // 设置名称
        if (Object.prototype.hasOwnProperty.call(this.options, 'name')) {
            this.ele.setAttr('name', this.options.name);
            this.ele.ele()!.dataset.name = this.options.name;
        }
    };
}
